package com.river.springbootdemo.thinkingjava.interfaces;

interface Cycle {
    void wheelCount();
}
interface CycleFactory{
    Cycle getCycle();
}

class UnicycleFactory implements CycleFactory{
    class Unicycle implements Cycle{
        @Override
        public void wheelCount() {
            System.out.println("Unicycle has one wheel");
        }
    }
    @Override
    public Cycle getCycle() {
        return new Unicycle();
    }
}

class BicycleFactory implements CycleFactory{
    class Bicycle implements Cycle{
        @Override
        public void wheelCount() {
            System.out.println("Bicycle has Two wheel");
        }
    }
    @Override
    public Cycle getCycle() {
        return new Bicycle();
    }
}

class TricycleFactory implements CycleFactory{
    class Tricycle implements Cycle{
        @Override
        public void wheelCount() {
            System.out.println("Bicycle has Two wheel");
        }
    }
    @Override
    public Cycle getCycle() {
        return new Tricycle();
    }
}

public class Cycels{
    public static void getCycleWheelCount(CycleFactory cycleFactory){
        Cycle cycle = cycleFactory.getCycle();
        cycle.wheelCount();
    }

    public static void main(String[] args) {
        getCycleWheelCount(new UnicycleFactory());
        getCycleWheelCount(new BicycleFactory());
        getCycleWheelCount(new TricycleFactory());
    }
}